
import pytesseract
from PIL import Image

pytesseract.pytesseract.tesseract_cmd = r'D:\Tesseract-OCR\tesseract.exe'
tessdata_dir_config = r'--tessdata-dir "D:\Tesseract-OCR\tessdata"'

image = Image.open('demo.jpg')

print(pytesseract.image_to_string(image, lang='eng', config=tessdata_dir_config))